#ifndef __INCLUDE_JNIHELP__
#define __INCLUDE_JNIHELP__

	#include <jni.h>
	#if defined __ANDROID__

		#pragma message("android os")
		#include <android/log.h>

		#define _LOG_TAG_ "JNI"
		#define LOGI(fmt, args...) __android_log_print(ANDROID_LOG_INFO, _LOG_TAG_, fmt, ##args)
		#define LOGD(fmt, args...) __android_log_print(ANDROID_LOG_DEBUG, _LOG_TAG_, fmt, ##args)
		#define LOGE(fmt, args...) __android_log_print(ANDROID_LOG_ERROR, _LOG_TAG_, fmt, ##args)
		#define LOGV(fmt, args...) __android_log_print(ANDROID_LOG_VERBOSE, _LOG_TAG_, fmt, ##args)
		#define LOGW(fmt, args...) __android_log_print(ANDROID_LOG_WARN, _LOG_TAG_, fmt, ##args)

	#elif ( defined _WIN32 )||( defined _WIN64 )
		#pragma message("windows os")
		#if _MSC_VER >1200
		#else

		#endif
	#elif ( defined __linux__ )||( defined __unix__ )

		#pragma message("unix/linux os")

	#elif __posix__

		#pragma message("posix os")

	#elif __APPLE__

		#pragma message("apple os")

	#else

		#pragma message("other os")

	#endif


	#ifndef __ERROR_GOTO__
	#define __ERROR_GOTO__
	
		#if defined __ANDROID__
			#define _ERROR(label,fmt,args...) { \
				LOGE(fmt,##args);goto label; \
			}
		#elif ( defined _WIN32 )||( defined _WIN64 )
			#define _ERROR(label,fmt,...) { \
				printf("Error:"); \
				printf(fmt,__VA_ARGS__); \
				printf("\n");goto label; \
			}
		#else
			#define _ERROR(label,fmt,args...) { \
				printf("Error:"); \
				printf(fmt,##args); \
				printf("\n");goto label; \
			}
		#endif

		#if ( defined _WIN32 )||( defined _WIN64 )
			#define error(label,fmt,...) _ERROR(label,fmt,__VA_ARGS__);
		#else
			#define error(label,fmt,args...) _ERROR(label,fmt,##args);
		#endif
	#endif

    #ifdef __cplusplus
    extern "C" {
    #endif

    int registerNativeMethods(JNIEnv *env, const char *className,const JNINativeMethod *gMethods, int numMethods);
    #define registerNatives(env,clz,array) registerNativeMethods(env,clz,array,sizeof(array)/sizeof(array[0]))

    #ifdef __cplusplus
    }
    #endif
#endif
